package org.elsfs.cloud.common.mybatis.ext.sql.support.condition;


import org.elsfs.cloud.common.mybatis.ext.sql.SqlParameterManager;
import org.elsfs.cloud.common.util.lang.NamingCase;

import java.util.Collection;

/**
 * 不在范围条件
 *

 */
public class NotInConditionItem extends InConditionItem {

    public NotInConditionItem(SqlParameterManager sqlParameterManager, String leftField, Collection<String> inFields, Collection<?> inValues) {
        super(sqlParameterManager, leftField, inFields, inValues);
    }

    /**
     * 构建SQL片段
     *
     * @param token IN部分SQL
     * @return SQL片段
     */
    @Override
    protected String buildSqlFragment(String token) {
        return String.format(
            "%s NOT IN (%s)",
            NamingCase.toUnderlineCase(this.leftField),
            token
        );
    }
}
